﻿﻿<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=0, width=device-width"/>
		<meta name="format-detection" content="telephone=no"/>
		<title>api</title>
		<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
		<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
		<link rel="stylesheet" type="text/css" href="../bill/css/billMenu.css" />
	<style>
	body{
		margin: 0;
		padding: 0;
	}
	.rl_icon{
		position: absolute;
		width: 50px;
		left: 10px;
		top: -25px;
	}
	.winButtonDiv2{
		overflow: hidden;
		border-top: 1px solid #e5e5e5;
		text-align: center;
		line-height: 45px;
	}
	.winCancelBtn2{
		width: 50%;
		height: 45px;
		float: left;
		border-radius: 0;
		background-color: #fff;
		border-right: 1px solid #e5e5e5;
	}
	.winOkBtn2{
		height: 45px;
		float: right;
		width: 50%;
		border-radius: 0;
		background-color: #fff;
		color: #db4537;
	}
	</style>
	</head>
	<body style="background-color: transparent">
		<div class="winDiv" style="display:block;margin:0 auto;margin-top:20%;border-radius:10px;width:80%;overflow:visible">
		<div  class="otherDivHeader" style="background:url('../../image/h1_bg.png') no-repeat;background-size:cover;position:relative;">
			<img class="rl_icon" src="../../image/rl_icon.png" alt="">
			添加日程
		</div>

		<div class="aui-flex-col" data-type="text" style="margin-right: 10px;">
		<div class="aui-flex-item-3 " style="height: 40px;line-height: 40px; text-align: left;color:#adadad;margin-left:10px;">
			标题:<font color="red" >*</font>
		</div>
		<div class="aui-flex-item-12 " style="padding-right: 10px">
			<input id="BZtitle"  type="text" class="textareaborder" value="" />
		</div>
		</div>

		<div class="aui-flex-col" data-type="text" style="margin-right: 10px;">
		<div class="aui-flex-item-3 " style="height: 30px;line-height: 30px;color:#adadad;margin-left:10px;">
			开始时间:
		</div>
		<div class="aui-flex-item-8 ">
			<input id="starttime"  type="datetime-local" class="textareaborder" value="" />
		</div>
		</div>

		<div class="aui-flex-col" data-type="text" style="margin-right: 10px;">
		<div class="aui-flex-item-3 " style="height: 30px;line-height: 30px;color:#adadad;margin-left:10px;">
			结束时间:
		</div>
		<div class="aui-flex-item-8 ">
			<input id="endtime"  type="datetime-local" class="textareaborder" value="" />
		</div>
		</div>

		<div class="aui-flex-col" data-type="text" style="margin-right: 10px;margin-top:-10px;">
		<div class="aui-flex-item-3 " style="height: 40px;line-height: 40px; text-align: left;color:#adadad;margin-left:10px;">
			日程:<font color="red" >*</font>
		</div>
		<div class="aui-flex-item-12 " style="padding-right: 10px">
			<textarea id="BZtext" class="dealInfo" rows="5" cols="10" placeholder="日程内容"></textarea>
		</div>
		</div>
		<div class="winButtonDiv2">
		<div class="winCancelBtn2"  onclick="api.closeFrame()">
			取消
		</div>
		<div class="winOkBtn2" id='btntext'  onclick="titalFunUp()">
			确定
		</div>
		</div>
		</div>
	</body>
	<script src="../../script/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/doT.min.js"></script>
	<script type="text/javascript" src="../../script/debug.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/config.js"></script>
	<script type="text/javascript" src="../../script/client.api.js"></script>
	<script type="text/javascript" src="../../script/aui-alert.js"></script>
	<script type="text/javascript" src="../../script/jquery-validate.js"></script>
	<script type="text/javascript" src="../../script/utils/FormUtil.js"></script>
	<script type="text/javascript" src="../../script/xunjian_db.js"></script>
	<script type="text/javascript" src="../../script/utils/ImageUtil.js"></script>
	<script type="text/javascript" src="libs/calendar.js"></script>
	<script type="text/javascript" src="../../script/navigate.js"></script>
	<script type="text/javascript" src="../../script/home_frm.js"></script>
	<script type="text/javascript" src="../../script/easydialog/easydialog.js"></script>



	<script  type="text/javascript">
				var scheduleid;
        apiready = function(){
						scheduleid=api.pageParam.scheduleid
        };
				function titalFunUp(){
					if($('#BZtitle').val()!=''&&$('#BZtext').val()!=''){
						api.showProgress({
							title : '处理中',
							modal : true,
						});
						var msg;
						if(scheduleid){
							var opts={
								title:$('#BZtitle').val(),
								msg:$('#BZtext').val(),
								starttime:$('#starttime').val(),
								endtime:$('#endtime').val(),
								date:api.pageParam.Newtime,
								scheduleid:scheduleid
							}
							msg="修改日程成功！"
						}else {
							var opts={
								title:$('#BZtitle').val(),
								msg:$('#BZtext').val(),
								starttime:$('#starttime').val(),
								endtime:$('#endtime').val(),
								date:api.pageParam.Newtime
							}
							msg="添加日程成功！"
						}

						console.log(JSON.stringify(opts));
						$client.addDayCalendar(opts,function(ret,err){
							console.log(JSON.stringify(ret));
							if (ret.success) {
								api.hideProgress();
								api.toast({
									msg : msg
								});
								api.execScript({
								    frameName: 'calendarFrm',
								    script: 'Refreshrili()'
								});
								api.closeFrame();
							} else {
								api.hideProgress();
								api.toast({
									msg : '添加日程失败！'
								});
							}
						})
					}else {
						api.toast({
							msg : '标题和内容不能为空！'
						});
					}
				}

	</script>
</html>
